//
//  MyBankCardView.m
//  wangzhe
//
//  Created by 李 佳伟 on 2017/10/19.
//  Copyright © 2017年 李 佳伟. All rights reserved.
//

#import "MyBankCardView.h"
#import "JTCSM.h"


@implementation MyBankCardView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        CGFloat space = 10;
        CGFloat top = 10;
        CGFloat labelHeight = 33;
        CGFloat imagesize = 20;
        CGFloat width = frame.size.width;
        self.bankNamebLabel = [UILabel initWithFrame:CGRectMake(space , top, width-2*space-imagesize*2, labelHeight) text:@"建设银行" font:16 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(237, 150, 121, 1) backgroundColor:nil];
        [self addSubview:self.bankNamebLabel];
        
        self.bankCardLabel = [UILabel initWithFrame:CGRectMake(space , KVIEW_Y(self.bankNamebLabel), width-2*space, labelHeight) text:@"6222 9999 6269 710" font:16 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(237, 150, 121, 1) backgroundColor:nil];
        [self addSubview:self.bankCardLabel];
        
        self.dateLabel = [UILabel initWithFrame:CGRectMake(space , KVIEW_Y(self.bankCardLabel), width/2-space, 20) text:@"09/15" font:16 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(237, 150, 121, 1) backgroundColor:nil];
        [self addSubview:self.dateLabel];
        
        self.timeLabel = [UILabel initWithFrame:CGRectMake(KVIEW_X(self.dateLabel) , KVIEW_Y(self.bankCardLabel), width/2-space, 20) text:@"09/15" font:16 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(237, 150, 121, 1) backgroundColor:nil];
        [self addSubview:self.timeLabel];
        
        self.nameLabel = [UILabel initWithFrame:CGRectMake(space , KVIEW_Y(self.timeLabel), width-2*space, 20) text:@"DEMON LEE" font:12 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(237, 150, 121, 1) backgroundColor:nil];
        [self addSubview:self.nameLabel];
        
        UIView *V1 = [[UIView alloc]initWithFrame:CGRectMake(width-space-imagesize*2-5, top+(labelHeight-imagesize)/2, imagesize, imagesize)];
        V1.backgroundColor = RGBACOLOR(237, 150, 121, .6);
        [self addSubview:V1];
        [df layerWithView:V1 radius:imagesize/2 width:0 color:nil];
        UIView *V2 = [[UIView alloc]initWithFrame:CGRectMake(width-space-imagesize-10, top+(labelHeight-imagesize)/2, imagesize, imagesize)];
        V2.backgroundColor = RGBACOLOR(237, 150, 121, .6);
        [self addSubview:V2];
        [df layerWithView:V2 radius:imagesize/2 width:0 color:nil];
        self.backgroundColor = [UIColor whiteColor];
        [df layerWithView:self radius:3 width:0 color:nil];
        self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, width, KVIEW_Y(self.nameLabel)+top);
        
    }
    
    return self;
}

@end
